package o;

import android.content.Context;
import android.content.res.Resources.NotFoundException;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.Display;
import android.view.View;
import android.view.ViewParent;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.RelativeLayout;
import androidx.annotation.DimenRes;
import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
import o.ayt.b;

public class azb {
    public static boolean ˎ(Context context) {
        return context.getResources().getConfiguration().orientation == 2;
    }

    public static DisplayMetrics ˋ(Context context) {
        DisplayMetrics displayMetrics = new DisplayMetrics();
        if (context != null) {
            WindowManager windowManager = (WindowManager) context.getSystemService("window");
            if (windowManager != null) {
                Display defaultDisplay = windowManager.getDefaultDisplay();
                if (defaultDisplay != null) {
                    defaultDisplay.getMetrics(displayMetrics);
                }
            }
        }
        return displayMetrics;
    }

    public static int ॱ(Context context) {
        return ˋ(context).widthPixels;
    }

    public static int ˊ(Context context) {
        return context.getResources().getDimensionPixelSize(b.ॱ) + ᐝ(context);
    }

    public static int ˏ(@NonNull Context context) {
        return context.getResources().getDimensionPixelSize(b.ˊ) + ʽ(context);
    }

    public static float ˋ(@NonNull Context context, @DimenRes int i) {
        TypedValue typedValue = new TypedValue();
        try {
            context.getResources().getValue(i, typedValue, true);
            return typedValue.getFloat();
        } catch (NotFoundException e) {
            ayv.ˎ.ˊ("ScreenUiHelper", "getDimenFloatValue: resources not found exception!");
            return 0.0f;
        }
    }

    public static boolean ʼ(Context context) {
        return (ᐝ(context) > 0 || ʽ(context) > 0) && azc.ˎ().ॱ() >= 21;
    }

    public static void ˏ(@NonNull View view) {
        if (view != null) {
            Context context = view.getContext();
            if (context != null && ʼ(context)) {
                view.setPaddingRelative(view.getPaddingStart() + ᐝ(context), view.getPaddingTop(), ʽ(context) + view.getPaddingEnd(), view.getPaddingBottom());
            }
        }
    }

    public static void ˊ(@NonNull View view) {
        if (view != null) {
            Context context = view.getContext();
            if (context != null && ʼ(context)) {
                view.setPaddingRelative(ᐝ(context) + view.getPaddingStart(), view.getPaddingTop(), view.getPaddingEnd(), view.getPaddingBottom());
            }
        }
    }

    public static void ˎ(@NonNull View view) {
        if (view != null) {
            Context context = view.getContext();
            if (context != null && ʼ(context)) {
                view.setPaddingRelative(view.getPaddingStart(), view.getPaddingTop(), ʽ(context) + view.getPaddingEnd(), view.getPaddingBottom());
            }
        }
    }

    public static void ˏ(@NonNull View view, @IdRes int i) {
        if (view != null) {
            View findViewById = view.findViewById(i);
            if (findViewById != null) {
                ˏ(findViewById);
            }
        }
    }

    public static void ˊ(@NonNull View view, @IdRes int i) {
        if (view != null) {
            View findViewById = view.findViewById(i);
            if (findViewById != null) {
                ˎ(findViewById);
            }
        }
    }

    public static int ᐝ(Context context) {
        if (!ayy.ˋ().ˎ() || ˎ(context)) {
            return 0;
        }
        return ayy.ˋ().ˏ();
    }

    public static int ʽ(Context context) {
        if (!ayy.ˋ().ˎ() || ˎ(context)) {
            return 0;
        }
        return ayy.ˋ().ˊ();
    }

    public static void ॱ(@NonNull View view, @IdRes int i) {
        if (view != null) {
            View findViewById = view.findViewById(i);
            if (findViewById != null) {
                ˋ(findViewById);
            }
        }
    }

    public static void ˋ(@NonNull View view) {
        if (view != null) {
            Context context = view.getContext();
            if (context != null && ʼ(context)) {
                ˋ(view, ˊ(context), ˏ(context));
            }
        }
    }

    public static void ˎ(@NonNull View view, @IdRes int i) {
        if (view != null) {
            View findViewById = view.findViewById(i);
            if (findViewById != null) {
                ॱ(findViewById);
            }
        }
    }

    public static void ॱ(@NonNull View view) {
        if (view != null) {
            Context context = view.getContext();
            if (context != null && ʼ(context)) {
                ʼ(view, ˊ(context));
            }
        }
    }

    public static void ˋ(@NonNull View view, @IdRes int i) {
        if (view != null) {
            View findViewById = view.findViewById(i);
            if (findViewById != null) {
                ʻ(findViewById);
            }
        }
    }

    public static void ʻ(@NonNull View view) {
        if (view != null) {
            Context context = view.getContext();
            if (context != null && ʼ(context)) {
                ॱॱ(view, ˏ(context));
            }
        }
    }

    public static void ˎ(@NonNull View view, @IdRes int i, int i2, int i3) {
        if (view != null) {
            View findViewById = view.findViewById(i);
            if (findViewById != null) {
                ˋ(findViewById, i2, i3);
            }
        }
    }

    public static void ˋ(@NonNull View view, int i, int i2) {
        if (view != null) {
            ViewParent parent = view.getParent();
            if (parent instanceof LinearLayout) {
                LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
                if (layoutParams != null) {
                    layoutParams.setMarginStart(i);
                    layoutParams.setMarginEnd(i2);
                    view.setLayoutParams(layoutParams);
                }
            } else if (parent instanceof RelativeLayout) {
                RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) view.getLayoutParams();
                if (layoutParams2 != null) {
                    layoutParams2.setMarginStart(i);
                    layoutParams2.setMarginEnd(i2);
                    view.setLayoutParams(layoutParams2);
                }
            } else if (parent instanceof FrameLayout) {
                FrameLayout.LayoutParams layoutParams3 = (FrameLayout.LayoutParams) view.getLayoutParams();
                if (layoutParams3 != null) {
                    layoutParams3.setMarginStart(i);
                    layoutParams3.setMarginEnd(i2);
                    view.setLayoutParams(layoutParams3);
                }
            }
        }
    }

    public static void ʼ(@NonNull View view, int i) {
        if (view != null) {
            ViewParent parent = view.getParent();
            if (parent instanceof LinearLayout) {
                LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
                if (layoutParams != null) {
                    layoutParams.setMarginStart(i);
                    view.setLayoutParams(layoutParams);
                }
            } else if (parent instanceof RelativeLayout) {
                RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) view.getLayoutParams();
                if (layoutParams2 != null) {
                    layoutParams2.setMarginStart(i);
                    view.setLayoutParams(layoutParams2);
                }
            } else if (parent instanceof FrameLayout) {
                FrameLayout.LayoutParams layoutParams3 = (FrameLayout.LayoutParams) view.getLayoutParams();
                if (layoutParams3 != null) {
                    layoutParams3.setMarginStart(i);
                    view.setLayoutParams(layoutParams3);
                }
            }
        }
    }

    public static void ॱॱ(@NonNull View view, int i) {
        if (view != null) {
            ViewParent parent = view.getParent();
            if (parent instanceof LinearLayout) {
                LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
                if (layoutParams != null) {
                    layoutParams.setMarginEnd(i);
                    view.setLayoutParams(layoutParams);
                }
            } else if (parent instanceof RelativeLayout) {
                RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) view.getLayoutParams();
                if (layoutParams2 != null) {
                    layoutParams2.setMarginEnd(i);
                    view.setLayoutParams(layoutParams2);
                }
            } else if (parent instanceof FrameLayout) {
                FrameLayout.LayoutParams layoutParams3 = (FrameLayout.LayoutParams) view.getLayoutParams();
                if (layoutParams3 != null) {
                    layoutParams3.setMarginEnd(i);
                    view.setLayoutParams(layoutParams3);
                }
            }
        }
    }

    public static int ʻ(@NonNull Context context) {
        return context.getResources().getDimensionPixelSize(b.ˎ) + ᐝ(context);
    }

    public static int ॱॱ(@NonNull Context context) {
        return context.getResources().getDimensionPixelSize(b.ˎ) + ʽ(context);
    }

    public static void ʽ(@NonNull View view, @IdRes int i) {
        if (view != null) {
            View findViewById = view.findViewById(i);
            if (findViewById != null) {
                ॱॱ(findViewById);
            }
        }
    }

    public static void ॱॱ(@NonNull View view) {
        if (view != null) {
            Context context = view.getContext();
            if (context != null && ʼ(context)) {
                ˋ(view, ʻ(context), ॱॱ(context));
            }
        }
    }

    public static int ॱ(fmz o_fmz, int i) {
        if (o_fmz == null) {
            o_fmz = new fmz(ContentManager.getInstant().getContext(), i);
        }
        o_fmz.ˋ(ContentManager.getInstant().getContext());
        return o_fmz.ˎ();
    }

    public static int ॱ(Context context, int i) {
        fmz o_fmz = new fmz(context, 0);
        o_fmz.ˋ(context);
        return ((ॱ(context) - o_fmz.ˎ()) / 2) - i;
    }

    public static void ᐝ(@NonNull View view, int i) {
        if (view != null) {
            Context context = view.getContext();
            if (context != null) {
                int ॱ = ॱ(context, i);
                ˋ(view, ॱ, ॱ);
            }
        }
    }

    public static void ʼ(@NonNull View view) {
        if (view != null) {
            Context context = view.getContext();
            if (context != null) {
                ᐝ(view, ˊ(context));
            }
        }
    }
}
